package pub.strawhat.album.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import pub.strawhat.album.dao.TopicsMapper;
import pub.strawhat.album.model.TopicsVO;

@Service
public class TopicsService {

	@Autowired
	private TopicsMapper topicsMapper;

	public Boolean saveTopics(TopicsVO topics) {
		return topicsMapper.addTopics(topics);
	}

	public Boolean updateTopics(TopicsVO topics) {
		return topicsMapper.updateTopics(topics);
	}

	public Boolean delTopics(Integer id) {
		return topicsMapper.delTopics(id);
	}

	public int getTopicsId() {
		return topicsMapper.getTopicsId();
	}

	public TopicsVO findTopicsById(Integer id) {
		return topicsMapper.findTopicsById(id);
	}

	public PageInfo<TopicsVO> findTopicsList(TopicsVO topics, Integer pageNum, Integer pageSize) {
		PageHelper.startPage(pageNum, pageSize);
		PageInfo<TopicsVO> pageInfo = new PageInfo<TopicsVO>(topicsMapper.findTopicsList(topics));
		return pageInfo;
	}
}
